﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="IEngine.cs" company="Skymate">
//   Copyright © 2015 Skymate. All rights reserved.
// </copyright>
// <summary>
//   实现了这个接口的类可以作为网站的各种服务组合Skymate引擎.
//   编辑功能,通过这个接口访问大部分Skymate功能模块和实现.
// </summary>
// --------------------------------------------------------------------------------------------------------------------
namespace Skymate.Engines
{
    using System;

    using Skymate.Engines.DependencyManagement;

    /// <summary>
    ///     实现了这个接口的类可以作为网站的各种服务组合Skymate引擎.
    ///     编辑功能,通过这个接口访问大部分Skymate功能模块和实现.
    /// </summary>
    public interface IEngine
    {
        /// <summary>
        ///     容器管理器.
        /// </summary>
        IIocManager ContainerManager { get; }

        /// <summary>
        ///     初始化组件和插件Skymate环境.
        /// </summary>
        void Initialize();

        /// <summary>
        /// 解析.
        /// </summary>
        /// <param name="name">
        /// 名称.
        /// </param>
        /// <typeparam name="T">
        /// 类型
        /// </typeparam>
        /// <returns>
        /// <see cref="T"/>.
        ///     类型
        /// </returns>
        T Resolve<T>(string name = null) where T : class;

        /// <summary>
        /// 解析.
        /// </summary>
        /// <param name="type">
        /// 类型.
        /// </param>
        /// <param name="name">
        /// 别称.
        /// </param>
        /// <returns>
        /// <see cref="object"/>.
        /// </returns>
        object Resolve(Type type, string name = null);

        /// <summary>
        ///     全部解析.
        /// </summary>
        /// <typeparam name="T">
        ///     类型
        /// </typeparam>
        /// <returns>
        ///     <see cref="T[]" />.
        /// </returns>
        T[] ResolveAll<T>();
    }
}